//
//  RecordButton.m
//  bitcoin
//
//  Created by caiyajun on 2018/5/28.
//  Copyright © 2018年 比特币. All rights reserved.
//

#import "RecordButton.h"
#import "UIImageView+WebCache.h"
@implementation RecordButton
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //1 设置图片填充模式为居中
        [self initUI];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self initUI];
    }
    return self;
}
- (void)initUI {
    self.imageView.contentMode = UIViewContentModeScaleToFill;
    self.backgroundColor=RGBColor(46, 49, 69);
    //2 设置标题的大小与对齐方式
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self setTitleColor:RGBColor(153, 153, 153) forState:UIControlStateNormal];
    //    [self setTitleColor:RGBColor(86, 111, 237) forState:UIControlStateSelected];
    self.titleLabel.font = [UIFont systemFontOfSize:12.0];
    //    self.backgroundColor = [UIColor blueColor];
}
#pragma mark - 取消按钮高亮
- (void)setHighlighted:(BOOL)highlighted{}

#pragma mark - 重新设置图片的尺寸位置
- (CGRect)imageRectForContentRect:(CGRect)contentRect{
    return  CGRectMake(self.frame.size.width/2-12, 7, 24, 20);
}

#pragma mark - 重新设置标题的尺寸位置
- (CGRect)titleRectForContentRect:(CGRect)contentRect{
    
    return  CGRectMake(0,33, self.frame.size.width, 12);
}
@end

